<div class="clearfix user-center-head">
  <strong class="pull-left normal"><?php echo L('request_record')?></strong>
  <a href="<?php echo url('user/order_purchase_list');?>" class="pull-right btn"><?php echo L('aftermarket_recoud')?></a>
</div>
<table width="100%" align="center" cellspacing="0" cellpadding="0" border="0"  class="orderpurchasetable-1">
  <tbody>
    <tr>
      <td width="20%"><?php echo L('goods_name')?></td>
      <td width="80%"><a href="<?php echo url('/product', 'id='.$purchaseInfo['product_id']);?>" target="_blank"><?php echo $purchaseInfo['product_name']?></a></td>
    </tr>
    <tr>
      <td><?php echo L('request_number')?></td>
      <td><?php echo $purchaseInfo['number']?></td>
    </tr>
    <tr>
      <td><?php echo L('request_type')?></td>
      <td><?php echo L(OrderModel::$purchaseType[$purchaseInfo['purchase_type']]);?></td>
    </tr>
    <tr>
      <td><?php echo L('service_status')?></td>
      <td id="purchase_status_td"><?php echo L(OrderModel::$purchaseStatus[$purchaseInfo['status']]);?></td>
    </tr>
    <tr>
      <td><?php echo L('question_desc')?></td>
      <td><?php echo $purchaseInfo['description']?></td>
    </tr>
    <tr>
      <td><?php echo L('upload_img')?></td>
<!--      <td>
	      <?php 
          if(isset($photoList) && $photoList):
          	foreach ($photoList as $photo):
          	$dir = dirname($photo['img']);
          	$img_name = basename($photo['img']);
          	$thumb_img = $dir.'/thumb_'.$img_name;
          ?>
        <div style="margin:10px;float:left;"> <a href="<?php echo $photo['img'];?>" class="lightbox" rel="flowers"> <img name="img_name"  style="margin:5px; opacity:1;" src='<?php echo $thumb_img;?>'/></a></div>
        <?php 
          	endforeach;
          endif;
          ?></td>-->
          <td><img width="400" src='<?php echo $purchaseInfo['images'];?>'></td>
    </tr>
    <tr>
      <td><?php echo L('contact_info')?></td>
      <td><?php echo L('contact_name') . ':' .$purchaseInfo['contact_name'] . '&nbsp;&nbsp;'. L('phone') .':'. $purchaseInfo['contact_phone'] . '&nbsp;&nbsp;'.  L('email') .':'. $purchaseInfo['contact_email'];?></td>
    </tr>
  </tbody>
</table>
<?php if($purchaseInfo['status']<3):?>
<div id="purchase_status" style="text-align:center;clear:both;margin-top:20px">
  <a href="javascript:purchaseStatus(<?php echo $purchaseInfo['id']?>,3)" class="btn btn-middle" style="margin-right:10px;"><?php echo L('_PURCHASE_RESOLVED_')?></a>
  <a href="javascript:purchaseStatus(<?php echo $purchaseInfo['id']?>,4)" class="btn btn-middle"><?php echo L('_PURCHASE_CANCAL_')?></a>
</div>
<?php endif;?>
<div class="user-center-head"><?php echo L('fkxx_info')?></div>
<?php if($purchaseInfo['status']<3):?>
<form action ="<?php echo url('user/order_purchase_edit', array('pur_id' => $purchaseInfo['id']));?>" method="post" id="purchaseForm">
  <table id="purchase_description" width="100%" cellspacing="0" cellpadding="0" border="0" class="orderpurchasetable-1">
    <tbody>
      <tr>
        <td width="20%" valign="top"><?php echo L('reply_content')?>: </td>
        <td width="80%">
          <textarea name="description" style="border:1px solid #ccc; width:98%; height:100px; margin-bottom:10px;" pattern="required" alt="<?php echo L('inputquestion')?>"></textarea>
          <input type="submit" name="dosubmit" class="btn btn-middle" style="display:block; margin-top:10px;" value="<?php echo L('saveuser')?>" />
        </td>
      </tr>
    </tbody>
  </table>
</form>
<?php endif;?>
<table width="100%" cellspacing="0" cellpadding="0" border="0" class="orderpurchasetable-1">
  <tbody>
    <?php
			if(isset($mesgList) && $mesgList):
       foreach ($mesgList as $msg):
       ?>
    <tr>
      <td width="20%"><?php echo $msg['user_id'] ?  L('you_reply') : L('admin_reply') ;?><br/>
        <?php echo date('Y-m-d H:i:s', $msg['add_time']);?></td>
      <td width="80%" bgcolor="#f8f8f8"><?php echo $msg['description']?></td>
    </tr>
    <?php 
       endforeach;
      endif;
      ?>
  </tbody>
</table>
<script src="/statics/front/js/plugins/jquery.lightbox.js"></script> 
<script>
$(document).ready(function(){
    $(".lightbox").lightbox({
	    fitToScreen: true
    });
	 
});  
function purchaseStatus(purid, sid)
{
	$.ajax({
		type:'POST',
		url:url('user/order_purchase_edit_status'),
		data:{pur_id:purid,status:sid},
		dataType:'json',
		success:function(data){
			$('#purchase_status').css('display','none');
			$('#purchase_description').css('display','none');
			if(data.error){
				alert(data.message);
			}else{
				$('#purchase_status_td').html(data.message);
			}
			}
	});
}
</script>